namespace SinaFinance.ChartLibrary.StockTopFiveChangesLibrary
{
    using System;
    using System.Diagnostics;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;

    public partial class StockTopFiveHistogram : UserControl
    {
        //private bool _contentLoaded;
        private double histogramAreaWidth = 90.0;
        private Color histogramColor = new Color();
        private Color histogramLineColor = new Color();
        private double histogramWidth = 90.0;
        private bool isLoad = true;
        //internal Grid LayoutRoot;
        //internal Rectangle rect;
        //internal Border vol;
        //internal Storyboard VOLStoryboard;
        //internal SplineDoubleKeyFrame widthAnimation1;
        //internal SplineDoubleKeyFrame widthAnimation2;

        public StockTopFiveHistogram()
        {
            this.InitializeComponent();
            base.Loaded += new RoutedEventHandler(this.StockTopFiveHistogram_Loaded);
        }

        //[DebuggerNonUserCode]
        //public void InitializeComponent()
        //{
        //    if (!this._contentLoaded)
        //    {
        //        this._contentLoaded = true;
        //        Application.LoadComponent(this, new Uri("/SinaFinance;component/ChartLibrary/StockTopFiveChangesLibrary/StockTopFiveHistogram.xaml", UriKind.Relative));
        //        this.VOLStoryboard = (Storyboard) base.FindName("VOLStoryboard");
        //        this.widthAnimation1 = (SplineDoubleKeyFrame) base.FindName("widthAnimation1");
        //        this.widthAnimation2 = (SplineDoubleKeyFrame) base.FindName("widthAnimation2");
        //        this.LayoutRoot = (Grid) base.FindName("LayoutRoot");
        //        this.vol = (Border) base.FindName("vol");
        //        this.rect = (Rectangle) base.FindName("rect");
        //    }
        //}

        private void StockTopFiveHistogram_Loaded(object sender, RoutedEventArgs e)
        {
            this.LayoutRoot.Width = this.histogramAreaWidth;
            double num = Convert.ToDouble(this.histogramWidth.ToString("0.00"));
            this.widthAnimation1.Value = 5.0;
            this.widthAnimation2.Value = num;
            this.vol.Background = new SolidColorBrush(this.HistogramColor);
            this.rect.Fill = new SolidColorBrush(this.HistogramLineColor);
            if (this.isLoad)
            {
                this.VOLStoryboard.Begin();
            }
            else
            {
                this.vol.Width = num;
            }
        }

        public double HistogramAreaWidth
        {
            get
            {
                return this.histogramAreaWidth;
            }
            set
            {
                this.histogramAreaWidth = value;
            }
        }

        public Color HistogramColor
        {
            get
            {
                return this.histogramColor;
            }
            set
            {
                this.histogramColor = value;
            }
        }

        public Color HistogramLineColor
        {
            get
            {
                return this.histogramLineColor;
            }
            set
            {
                this.histogramLineColor = value;
            }
        }

        public double HistogramWidth
        {
            get
            {
                return this.histogramWidth;
            }
            set
            {
                this.histogramWidth = value;
            }
        }

        public bool IsLoad
        {
            get
            {
                return this.isLoad;
            }
            set
            {
                this.isLoad = value;
            }
        }
    }
}
